import { createApp } from 'vue';
import router from './phoneOa/router/index';
import App from './app';
import './phoneOa/assets/fonts/iconfont.css';
import '@/assets/css/tailwind.css';
import './phoneOa/assets/css/global.scss';
import { FastClick } from 'fastclick';

FastClick.attach(document.body);
FastClick.prototype.focus = function (targetElement: {
  setSelectionRange: (arg0: any, arg1: any) => void;
  type: string | string[];
  value: string | any[];
  focus: () => void;
}) {
  let length;
  if (targetElement.setSelectionRange && targetElement.type.indexOf('date') !== 0 && targetElement.type !== 'time' && targetElement.type !== 'month') {
    length = targetElement.value.length;
    targetElement.focus();
    targetElement.setSelectionRange(length, length);
  } else {
    targetElement.focus();
  }
};
(async () => {
  // const _menuList: MenuInfo[] = JSON.parse(window.localStorage.getItem('menuList')!);
  // if (_menuList) {
  //   setRouter(_menuList);
  // }
})()
  .catch((e) => {
    console.error(e);
    return Promise.reject();
  })
  .then(() => {
    const app = createApp(App);
    // //fastclick
    // if ('addEventListener' in document) {
    //   document.addEventListener('DOMContentLoaded', function () {
    //     FastClick.attach(document.body);
    //   }, false);
    // }
    app.use(router).mount('#app');
  })
  .catch((e) => {});
